# A sample configuration for fedora-messaging. This file is in the TOML format.
# For complete details on all configuration options, see the documentation.
# https://fedora-messaging.readthedocs.io/en/stable/configuration.html

# Broker address
amqp_url = "amqps://toddlers{{ env_suffix }}:@rabbitmq{{ env_suffix }}.fedoraproject.org/%2Fpubsub"
callback = "toddlers.runner:RunningToddler"

# Just check if the queue exist, don't try to create it as you won't be allowed
# to (this is done in the ansible playbook)
passive_declares = true

# The topic_prefix configuration value will add a prefix to the topics of every sent message.
# This is used for migrating from fedmsg, and should not be used afterwards.
{% if env == "staging" %}
topic_prefix = "org.fedoraproject.stg"
{% else %}
topic_prefix = "org.fedoraproject.prod"
{% endif %}

[tls]
ca_cert = "/etc/pki/rabbitmq/ca/toddlers.ca"
keyfile = "/etc/pki/rabbitmq/key/toddlers.key"
certfile = "/etc/pki/rabbitmq/cert/toddlers.crt"

[client_properties]
app = "toddlers"
app_url = "https://pagure.io/fedora-infra/toddlers"

[queues."toddlers{{ env_suffix }}"]
durable = true
auto_delete = false
exclusive = false
arguments = {}

[[bindings]]
queue = "toddlers{{ env_suffix }}"
exchange = "amq.topic"
routing_keys = ["#"]  # This is dynamically generated in the code

[consumer_config]
# Comment out or remove this line if you want to enable the debug toddler.
# Or add more toddlers to the list (using their name) if you want to disable
# more of them.
blocked_toddlers = ["debug"]

[consumer_config.default]
# Configuration common to all toddlers.
#
# You can override any of these in the section of a particular toddler, e.g.:
#
# [consumer_config.default]
# somekey = "somevalue"
# ...
# [consumer_config.sometoddler]
# somekey = "someothervalue"


# Configuration used when sending notifications:
{% if env == "staging" %}
mail_server = "bastion.stg.fedoraproject.org"
admin_email = "admin@stg.fedoraproject.org"
{% else %}
mail_server = "bastion.fedoraproject.org"
admin_email = "admin@fedoraproject.org"
{% endif %}

# Use fasjson instead of FAS
fasjson = true

# Account to use to connect to FAS/FASJSON
fas_url = "https://fasjson{{ env_suffix }}.fedoraproject.org/"
{% if env != "staging" %}
fas_username = "{{ fedoraDummyUser }}"
fas_password = "{{ fedoraDummyUserPassword }}"
{% else %}
fas_username = "{{ fedoraStagingDummyUser }}"
fas_password = "{{ fedoraStagingDummyUserPassword }}"
{% endif %}

# Account to use to connect to bugzilla
{% if env != "staging" %}
bugzilla_url = "https://bugzilla.redhat.com"
bugzilla_api_key = "{{ toddlers_bz_api_key }}"
{% else %}
bugzilla_url = "https://bugzilla.stage.redhat.com"
bugzilla_api_key = "{{ toddlers_stg_bz_api_key }}"
{% endif %}
bugzilla_group = "fedora_contrib"

# Base URL for the Koji build system
koji_url = "https://koji{{ env_suffix }}.fedoraproject.org"

# Base URL for the Koji package db
kojipkgs_url = "https://kojipkgs{{ env_suffix }}.fedoraproject.org"

# Account to use to connect to Pagure-as-dist-git
dist_git_url = "https://src{{ env_suffix }}.fedoraproject.org"
{% if env == "staging" %}
dist_git_token = "{{ toddlers_stg_dist_git_token }}"
{% else %}
dist_git_token_seed = "{{ toddlers_flag_ci_seed }}"
dist_git_token = "{{ toddlers_dist_git_token }}"
{% endif %}

#  Configuration file storing all the email overrides in the form of:
# "foo@bar.com" = "bar@foo.org"
# This is the same format as used by the distgit_bugzilla_sync cron/app
email_overrides_file = "/etc/fedora-messaging/email_overrides.toml"

# List of accounts we do not want to report about
ignorable_accounts = ["packagerbot", "zuul", "cockpit"]

# Temp folder to use for toddlers temp files
temp_folder = "/var/tmp"


[consumer_config.default.pdc_config]
# Configuration to talk to PDC, as understood by pdc-client.
server = "https://pdc{{ env_suffix }}.fedoraproject.org/rest_api/v1/"
ssl_verify = false  # Enable if using a self-signed cert
{% if env == "staging" %}
token = "{{ pdc_updater_api_token_stg }}"
{% else %}
token = "{{ pdc_updater_api_token_prod }}"
{% endif %}

[consumer_config.flag_ci_pr]

[consumer_config.flag_commit_build]

[consumer_config.packager_bugzilla_sync]

[consumer_config.pdc_retired_packages]
file_check_url = "https://src{{ env_suffix }}.fedoraproject.org/%(namespace)s/%(repo)s/blob/%(branch)s/f/%(file)s"

[consumer_config.pdc_import_compose]
old_composes_url = "https://kojipkgs{{ env_suffix }}.fedoraproject.org/compose/"

[consumer_config.pdc_modules]
mbs_url = "https://mbs{{ env_suffix }}.fedoraproject.org/module-build-service/2/module-builds/"

[consumer_config.check_email_overrides]
email_overrides_url = "https://pagure.io/fedora-infra/ansible/raw/main/f/roles/openshift-apps/toddlers/templates/email_overrides.toml"

[consumer_config.clean_retired_packages]
pdc_active_branches = "https://pdc{{ env_suffix }}.fedoraproject.org/extras/active_branches.json"

[consumer_config.packagers_without_bugzilla]
ignorable_namespaces = ["tests"]


[consumer_config.distgit_bugzilla_sync]
# FAS username of default QA contact for bugzilla tickets
# default_qa_contact = "extras-qa@fedoraproject.org"
# Admin addresses to notify
{% if env == "staging" %}
# Don't notify anyone on staging
notify_admins = []
{% else %}
notify_admins = [
    "kevin@fedoraproject.org",
    "pingou@fedoraproject.org",
]
{% endif %}

# PDC types mapping for distgit_bugzilla_sync toddler
[consumer_config.distgit_bugzilla_sync.pdc_types]
"rpms" = "rpm"
"modules" = "module"
"container" = "container"

# Bugzilla products informations for Fedora
[consumer_config.distgit_bugzilla_sync.products]

[consumer_config.distgit_bugzilla_sync.products.Fedora]
namespace = "rpms"
versions = ["rawhide", "33", "32"]

[consumer_config.distgit_bugzilla_sync.products."Fedora Container Images"]
namespace = "container"
versions = ["rawhide", "33", "32"]

[consumer_config.distgit_bugzilla_sync.products."Fedora Modules"]
namespace = "modules"
versions = []

[consumer_config.distgit_bugzilla_sync.products."Fedora EPEL"]
# To simplify to '^epel\d+$' once EL6 is EOL.
branch_regex = '^e(pe)?l\d+$'
versions = ["epel8", "epel7", "el6"]


# Configuration section for scm_request_processor
[consumer_config.scm_request_processor]
# FAS username of the user that will comment on behalf of toddler
{% if env == "staging" %}
pagure_user = "releng-bot"
pagure_url = "https://stg.pagure.io"
pagure_api_key = "{{ toddlers_stg_pagure_scm_request_processor_token }}"
{% else %}
pagure_user = "releng-bot"
pagure_url = "https://pagure.io"
pagure_api_key = "{{ toddlers_pagure_scm_request_processor_token }}"
{% endif %}
# Monitoring choices for release-monitoring.org
monitor_choices = ['no-monitoring', 'monitoring', 'monitoring-with-scratch']
# What we should look for in validation comment
validation_comment = "valid"
# Text for the ping if the ticket needs to be manually verified
ping_comment = "This request wants to skip bugzilla validation! {maintainers} could you check if this is correct? If yes, please respond to this ticket with 'valid' comment"

# Pagure mapping to bugzilla
[consumer_config.scm_request_processor.pagure_namespace_to_component]
rpms = 'Package Review'
container = 'Container Review'
modules = 'Module Review'
test-modules = 'Module Review'

[consumer_config.scm_request_processor.pagure_namespace_to_product]
rpms = ['Fedora', 'Fedora EPEL']
container = ['Fedora Container Images']
modules = ['Fedora Modules']
test-modules = ['Fedora']

# SLAS configuration for scm_request_processor
[consumer_config.scm_request_processor.branch_slas]

[consumer_config.scm_request_processor.branch_slas.rawhide]
rawhide = '2222-01-01'

[consumer_config.scm_request_processor.branch_slas.stable]
rawhide = '2222-01-01'

[consumer_config.scm_request_processor.branch_slas.main]
rawhide = '2222-01-01'

[consumer_config.scm_request_processor.branch_slas.epel9]
stable_api = '2032-05-31'
security_fixes = '2032-05-31'
bug_fixes = '2032-05-31'

[consumer_config.scm_request_processor.branch_slas.epel9-next]
stable_api = '2027-05-31'
security_fixes = '2027-05-31'
bug_fixes = '2027-05-31'

[consumer_config.scm_request_processor.branch_slas.epel8]
stable_api = '2029-05-31'
security_fixes = '2029-05-31'
bug_fixes = '2029-05-31'

[consumer_config.scm_request_processor.branch_slas.epel8-playground]
stable_api = '2029-05-31'
security_fixes = '2029-05-31'
bug_fixes = '2029-05-31'

[consumer_config.scm_request_processor.branch_slas.epel8-next]
stable_api = '2024-05-31'
security_fixes = '2024-05-31'
bug_fixes = '2024-05-31'

[consumer_config.scm_request_processor.branch_slas.epel7]
stable_api = '2024-06-30'
security_fixes = '2024-06-30'
bug_fixes = '2024-06-30'

[consumer_config.scm_request_processor.branch_slas.f37]
bug_fixes = '2023-11-14'
security_fixes = '2023-11-14'

[consumer_config.scm_request_processor.branch_slas.f36]
bug_fixes = '2023-05-16'
security_fixes = '2023-05-16'

[consumer_config.scm_request_processor.branch_slas.f35]
security_fixes = '2022-11-26'
bug_fixes = '2022-11-26'

[consumer_config.scm_request_processor.branch_slas.f34]
security_fixes = '2022-03-08'
bug_fixes = '2022-03-08'

[qos]
prefetch_size = 0
prefetch_count = 1

[log_config]
version = 1
disable_existing_loggers = true

[log_config.formatters.simple]
format = "%(asctime)s - [%(levelname)s %(name)s] %(message)s"

[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"

[log_config.loggers.fedora_messaging]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.loggers.twisted]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.loggers.pika]
level = "WARNING"
propagate = false
handlers = ["console"]

# Toddlers logger, feel free to bump the level to DEBUG if you need to
[log_config.loggers.toddlers]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.loggers.toddlers.utils.bugzilla_system]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.loggers.toddlers.plugins.pdc_retired_packages]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.loggers.toddlers.plugins.pdc_import_compose]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.loggers.toddlers.plugins.distgit_bugzilla_sync]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.root]
level = "ERROR"
handlers = ["console"]
